CREATE TABLE [dbo].[TXMODE_ASTO]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[NU_ANNO] [dbo].[TD_IN_004_ANNO] NOT NULL CONSTRAINT [DF__TXMODE_AS__NU_AN__3B95D2F1] DEFAULT (datepart(year,getdate())),
[CO_MODE_ASTO] [dbo].[TD_VC_003] NOT NULL,
[NU_SECU] [dbo].[TD_IN_001] NOT NULL,
[NO_MODE_ASTO] [dbo].[TD_VC_050] NULL,
[CO_CNTA_EMPR] [dbo].[TD_VC_020_CNTA] NOT NULL,
[TI_OPER] [dbo].[TD_VC_003] NOT NULL,
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TXMODE_AS__FE_US__3E723F9C] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TXMODE_AS__FE_US__3F6663D5] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TXMODE_ASTO] ADD CONSTRAINT [CK__TXMODE_AS__CO_CN__3D7E1B63] CHECK (([CO_CNTA_EMPR]>='0' AND [CO_CNTA_EMPR]<='99999999999999999999'))
GO
ALTER TABLE [dbo].[TXMODE_ASTO] ADD CONSTRAINT [CK__TXMODE_AS__NU_AN__3C89F72A] CHECK (([NU_ANNO]>=(0)))
GO
ALTER TABLE [dbo].[TXMODE_ASTO] ADD CONSTRAINT [TXMODE_AST_2511479401] PRIMARY KEY CLUSTERED  ([CO_EMPR], [NU_ANNO], [CO_MODE_ASTO], [NU_SECU]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TXMODE_ASTO] ADD CONSTRAINT [FK1_TMPARA_CONT_A_TXMODE_ASTO] FOREIGN KEY ([CO_EMPR]) REFERENCES [dbo].[TMPARA_CONT] ([CO_EMPR])
GO
ALTER TABLE [dbo].[TXMODE_ASTO] ADD CONSTRAINT [FK1_TMPLAN_ANNO_A_TXMODE_ASTO] FOREIGN KEY ([CO_EMPR], [CO_CNTA_EMPR]) REFERENCES [dbo].[TMPLAN_ANNO] ([CO_EMPR], [CO_CNTA_EMPR])
GO
